import 'package:flutter_modular/flutter_modular.dart';
import 'package:thinking/config/_.dart';
import 'package:thinking/utils/_.dart';
import 'package:thinking/views/App.dart';
import 'package:thinking/views/Dynamic/DynamicNews.dart';
import 'package:thinking/views/Dynamic/MoreRecentVisit.dart';
import 'package:thinking/views/Info/DynamicInfoWidget.dart';
import 'package:thinking/views/Info/thinkInfo.dart';
import 'package:thinking/views/Personal/Personal.dart';
import 'package:thinking/views/Personal/PersonalTitleBottom/PersonalSub.dart';
import 'package:thinking/views/Personal/PersonalTitleBottom/PersonalTitleBottom.dart';
import 'package:thinking/views/Personal/PersonalTool/PersonalPay.dart';
import 'package:thinking/views/Personal/PersonalTool/PersonalUpdateData.dart';
import 'package:thinking/views/Personal/PersonalTool/Personalcustomer.dart';
import 'package:thinking/views/Personal/PersonalTopItem.dart';
import 'package:thinking/views/Search/indexResultsList.dart';
import 'package:thinking/views/Search/indexSearch.dart';
import 'package:thinking/views/SignUp/SignUp.dart';
import 'package:thinking/views/Splash.dart';
import 'package:thinking/views/TopicView/TopicClass.dart';
import 'package:thinking/views/TopicView/TopicIndex.dart';
import 'package:thinking/views/welcome.dart';
import 'package:thinking/views/Index/CountryList.dart';

///路由配置
class AppRouter extends Module {
  @override
  List<Bind> get binds => [];

  @override
  List<ModularRoute> get routes => [
        ChildRoute('/',
            child: (_, __) => Splash(), transition: TransitionType.fadeIn),
        ChildRoute('/index',
            child: (_, args) => App(), transition: TransitionType.rightToLeft),
        ChildRoute('/signUp',
            child: (_, args) =>
                SPreferences().getBool('isLogin', false)! ? App() : SignUp(),
            transition: TransitionType.rightToLeft),
        ChildRoute('/welCome',
            child: (_, args) => !Config.isOpened
                ? Welcome()
                : SPreferences().getBool('isLogin', false)!
                    ? App()
                    : SignUp(),
            transition: TransitionType.rightToLeft),
        ChildRoute('/countryList/:countryIndex',
            child: (_, args) =>
                CountryList(countryIndex: args.params['countryIndex']),
            transition: TransitionType.leftToRight),
        ChildRoute('/indexSearch/:searchStatus',
            child: (_, args) => IndexSearch(
                  searchStatus: int.parse(args.params['searchStatus']),
                ),
            transition: TransitionType.rightToLeft),
        ChildRoute('/dynamicNews',
            child: (_, args) => DynamicNews(),
            transition: TransitionType.rightToLeft),
        ChildRoute('/indexResultsList/:value/:indexSearch',
            child: (_, args) => IndexResultsList(
                  value: args.params['value'],
                  indexSearch: int.parse(args.params['indexSearch']),
                ),
            transition: TransitionType.rightToLeft),
        ChildRoute('/topicIndex/:id/:name/:isSub',
            child: (_, args) => TopicIndex(
                topicIndexId: int.parse(args.params['id']),
                topicIndexName: args.params['name'],
                isSub: args.params['isSub'],
                ),
            transition: TransitionType.rightToLeft),
        ChildRoute('/topicClass',
            child: (_, args) => TopicClass(),
            transition: TransitionType.rightToLeft),
        ChildRoute('/personalSub',
        child: (_, args) => PersonalSub(),
        transition: TransitionType.rightToLeft),
        ChildRoute('/personalTitleBottom/:index',
        child: (_, args) => PersonalTitleBottom(
          index:int.parse(args.params['index']),
        ),
        transition: TransitionType.rightToLeft),
        ChildRoute('/personal/:id',
        child: (_, args) => Personal(userId: int.parse(args.params['id']),),
        transition: TransitionType.rightToLeft),
        ChildRoute('/personalTopItem/:userId/:pageIndex/:userName',
        child: (_, args) => PersonalTopItem(
          userId: int.parse(args.params['userId']),
          pageIndex: int.parse(args.params['pageIndex']),
          userName: args.params['userName'],
        ),
        transition: TransitionType.rightToLeft),
    ChildRoute('/thinkInfo/:thinkId/:thinkCategory',
        child: (_, args) => ThinkInfoWidget(
          thinkId: int.parse(args.params['thinkId']),
          thinkCategory: int.parse(args.params['thinkCategory']),

        ),
        transition: TransitionType.rightToLeft),
        ChildRoute('/personalCustomer',
        child: (_, args) => PersonalCustomer(),

        transition: TransitionType.rightToLeft),
    ChildRoute('/personalPay',
        child: (_, args) => PersonalPay(),
        transition: TransitionType.rightToLeft),
    ChildRoute('/personalUpdateData',
        child: (_, args) => PersonalUpdateData(),

        transition: TransitionType.rightToLeft),
    ChildRoute('/moreRecentVisit',
        child: (_, args) => MoreRecentVisit(),

        transition: TransitionType.rightToLeft),
    ChildRoute('/dynamicInfoWidget/:id',
        child: (_, args) => DynamicInfoWidget(
          id: int.parse(args.params['id']),
        ),
        transition: TransitionType.rightToLeft),

      ];
}
